/*
 * Name 		: Chang Hyun Park
 * Student ID	: 2007******
 * Major		: Computer Engineering
 * Year			: 3rd Year
 * Subject		: File Management
 * Filename		: header.h
 */

#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <string.h>

//#define BUFFER 10

//Structure Definitions
typedef struct _node
{
	struct _node* next;
	int bufVal;	//Initialized to 0 in init_linkedlist();
	//int ID;
	int reference;//-1 Meaning empty
}node;

//Global variables
int buffer_size;


//Function Prototypes/Declaration
//inputmanager.c
int get_buffer_size(void);
FILE* get_filename_input(int argc, char* argv[],char* filename);
int read_data(FILE* input, int** filedata, char* filename);
inline void clockTime( long * pSec, float * pUsec);
void print_header();
void print_stat(float percent, char* algorithm, int process, int hit, int miss,
																	float time);

//linkedlist.c
node* init_linkedlist(node* head);

//freemanager.c
void freemem(char* filename, int* filedata, node* head, int* lru_buf,
												int* mru_buf, int** lfu_buf);

//clock.c
int hit(int temp_num, node* head);
node* find_victim_replace(node** victim, int data);
int clock(int temp_num, node* head, node** victim, int* filedata);

//otheralgorithms.c
void init_arrays(int** lru_buf, int** mru_buf, int*** lfu_buf);
int hit_lmru(int num, int* buf);
int hit_lfu(int num, int** buf);
int lru(int num, int* lru_buf, int* buf, int lru_process_count);
int mru(int num, int* mru_buf, int* buf, int mru_process_count);
int lfu(int num, int** lfu_buf, int* buf, int lfu_process_count);
int find_min(int** lfu_buf);
